namespace IAM.Interface.Common.Providers
{
    using IAM.Interface.Model;
    using System;

    public class ProviderMgnt
    {
        private TransmissionParameter _tranpar = null;
        private string _xml = "";

        public ProviderMgnt(TransmissionParameter tranpar, string xml)
        {
            this._tranpar = tranpar;
            this._xml = xml;
        }

        public IProvider CreateProvider()
        {
            switch (this._tranpar.ProviderEnum)
            {
                case ProviderEnum.Http:
                    return new HttpProvider(this.URL, this.XML);

                case ProviderEnum.Local:
                    return new LocalProvider(this.URL, this.XML);

                case ProviderEnum.SAP:
                    return new SAPProvider(this.URL, this.XML);
            }
            return null;
        }

        public virtual string URL
        {
            get
            {
                return this._tranpar.URL;
            }
        }

        public virtual string XML
        {
            get
            {
                return this._xml;
            }
            set
            {
                this._xml = value;
            }
        }
    }
}
